package qianxin;

import java.util.Scanner;

/**
 * @author Hang
 * @date 2022/8/25
 * @project AutumnOffer
 * @description
 **/
public class Solution2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] height = new int[4];
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        height[0] = a;
        height[1] = b;
        height[2] = c;
        height[3] = d;
        int i = 0, j = 3, res = 0;
        while (i < j) {
            res = height[i] < height[j] ? Math.max(res,
                    (j - i) * height[i++]) : Math.max(res, (j - i) * height[j--]);
        }
        System.out.println(res);
    }
}
